/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sai
 */
import sai.mysql.DriverLoading;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class Ajax extends HttpServlet
{
Statement prepare,prepare1;
    @Override
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    try
    {
   String user=req.getParameter("username");
   DriverLoading dl = new DriverLoading();
   prepare = dl.getStatement();
   ResultSet rs=prepare.executeQuery("select userid from `logindetails` where userid='"+user+"'");
   boolean b=rs.next();
   if(b)
   {
       out.println("exists");      
   }
   else
   {
       out.println("succesful");
   }
    }
    catch(Exception e)
    {
        out.println(e);
    } 
}
}